package com.last1mile.dao.ibatis.impl;

import java.sql.SQLException;
import java.util.List;

import org.springframework.stereotype.Component;

import com.last1mile.dao.BaseSqlMapClientDao;
import com.last1mile.dao.interfaces.StateDao;
import com.last1mile.pojo.StateDO;

@Component("stateDao")
public class StateDaoImpl extends BaseSqlMapClientDao implements StateDao {
	@SuppressWarnings("unchecked")
	@Override
	public List<StateDO> selectByStateUpId(String stateUpId)
			throws SQLException {
		StateDO key = new StateDO();
		key.setStateUpId(stateUpId);
		List<StateDO> records = (List<StateDO>) getSqlMapClientTemplate()
				.queryForList("state.selectByStateUpId", key);
		return records;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table state
	 * 
	 * @abatorgenerated Wed Mar 28 11:37:54 CST 2012
	 */
	public void insert(StateDO record) throws SQLException {
		getSqlMapClientTemplate()
				.insert("state.abatorgenerated_insert", record);
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table state
	 * 
	 * @abatorgenerated Wed Mar 28 11:37:54 CST 2012
	 */
	public int updateByPrimaryKey(StateDO record) throws SQLException {
		int rows = getSqlMapClientTemplate().update(
				"state.abatorgenerated_updateByPrimaryKey", record);
		return rows;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table state
	 * 
	 * @abatorgenerated Wed Mar 28 11:37:54 CST 2012
	 */
	public int updateByPrimaryKeySelective(StateDO record) throws SQLException {
		int rows = getSqlMapClientTemplate().update(
				"state.abatorgenerated_updateByPrimaryKeySelective", record);
		return rows;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table state
	 * 
	 * @abatorgenerated Wed Mar 28 11:37:54 CST 2012
	 */
	public StateDO selectByPrimaryKey(Integer id) throws SQLException {
		StateDO key = new StateDO();
		key.setId(id);
		StateDO record = (StateDO) getSqlMapClientTemplate().queryForObject(
				"state.abatorgenerated_selectByPrimaryKey", key);
		return record;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table state
	 * 
	 * @abatorgenerated Wed Mar 28 11:37:54 CST 2012
	 */
	public int deleteByPrimaryKey(Integer id) throws SQLException {
		StateDO key = new StateDO();
		key.setId(id);
		int rows = getSqlMapClientTemplate().delete(
				"state.abatorgenerated_deleteByPrimaryKey", key);
		return rows;
	}

}
